package avicit.bdp.dcs.detail.rest;

import avicit.bdp.dcs.detail.dto.DataDetailDto;
import avicit.bdp.dcs.detail.service.TaskDataDetailService;
import avicit.platform6.core.rest.msg.QueryRespBean;
import avicit.platform6.core.rest.msg.ResponseMsg;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @金航数码科技有限责任公司
 * @作者：developer
 * @邮箱：developer@avic-digital.com
 * @创建时间： 2020-08-03 11:19
 * @类说明：数据明细接口
 * @修改记录：
 */
@RestController
@RequestMapping("/api/bdp/dcs/detail/TaskDataDetailRest")
@Api(tags = "数据明细接口")
public class TaskDataDetailRest {

    private static final Logger logger = LoggerFactory.getLogger(TaskDataDetailRest.class);

    @Autowired
    private TaskDataDetailService taskDataDetailService;

    @GetMapping("/getTaskDataDetailList")
    @ApiOperation(value = "查询数据迁移详情")
    public ResponseMsg<QueryRespBean<DataDetailDto>> getTaskDataDetailList(@ApiParam(value = "jobId", name = "jobId", required = true) @RequestParam String jobId,
                                                                           @ApiParam(value = "源表名", name = "srcTableName") @RequestParam(required = false) String srcTableName,
                                                                           @ApiParam(value = "当前页", name = "currentPage", required = true)  @RequestParam(defaultValue = "1") Integer currentPage,
                                                                           @ApiParam(value = "每页显示条数", name = "pageSize", required = true) @RequestParam(defaultValue = "10") Integer pageSize) {
        ResponseMsg<QueryRespBean<DataDetailDto>> responseMsg = new ResponseMsg<>();
        QueryRespBean<DataDetailDto> queryRespBean = taskDataDetailService.getTaskDataDetailListByJobIdPage(jobId, srcTableName, currentPage, pageSize);
        responseMsg.setResponseBody(queryRespBean);
        return responseMsg;
    }

}
